#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

int g_unval;
int g_val = 100;


int main(int argc, char *argv[], char *env[])
{
    static int val = 10;
    static int unval;
    const char *str = "helloworld";
    printf("代码: %p\n", main);
    printf("只读常量: %p\n", str);
    printf("已初始化全局变量: %p\n", &g_val);
    printf("已初始化局部静态变量: %p\n", &val); 
    printf("未初始化局部静态变量: %p\n", &unval); 
    printf("未初始化全局变量: %p\n", &g_unval);
    char *heap_mem = (char*)malloc(10);
    char *heap_mem1 = (char*)malloc(10);
    char *heap_mem2 = (char*)malloc(10);
    char *heap_mem3 = (char*)malloc(10);
    printf("堆区: %p\n", heap_mem);  
    printf("堆区: %p\n", heap_mem1); 
    printf("堆区: %p\n", heap_mem2); 
    printf("堆区: %p\n", heap_mem3); 

    printf("栈区: %p\n", &heap_mem);
    printf("栈区: %p\n", &heap_mem1); 
    printf("栈区: %p\n", &heap_mem2); 
    printf("栈区: %p\n", &heap_mem3); 

    for(int i = 0 ;i < argc; i++)
    {
        printf("argv[%d]: %p\n", i, argv[i]);
    }
    for(int i = 0; env[i]; i++)
    {
        printf("env[%d]: %p\n", i, env[i]);
    }

    return 0;
}

